from datetime import datetime
from pymongo import MongoClient

client=MongoClient()
a=datetime.strptime('20180101','%Y%m%d')
b=datetime.strptime('20180102','%Y%m%d')

db=client['crypto_1min']['bitfinex_btc_usd']
time={'start_time':{'$gte':a},'end_time':{'$lte':b}}
data=db.find(time)
for i in data:
    print(i)